Do

Syntax: @Do object_name

The Do command can be used to call (i.e. invoke) another Knowledge Explorer object, such as Dialog, Report or Procedure at run time.

With Procedures, this gives an efficient way of using 'sub routines' by breaking down long procedures into more manageable blocks, as well as being able to reuse common code blocks more easily.

With Dialogs, you can invoke knowledge that you have implemented via the controls. You can also call dialogs to implement 'pop up' sub dialogs from a main dialog. However, calling dialogs like this should not be used as a 'dialog script' to drive sequences of dialogs and care must be taken to avoid recursively calling the same dialog. Within sub dialogs the Back key should not be implemented, as the function would be identical to pressing the OK button in this instance.

When used to call objects such as an Attribute, the Do command would start the inference process using any Knowledge held by that object (e.g. a decision tree or table of cases). If there is no knowledge, or the knowledgeMode property is not set to use it, then the attribute value would just be prompted for.

You must not start more than one inference mechanism at a time. You must take care to avoid situations where you are making recursive calls or you risk getting into infinite loops and other problems.

An extra parameter can be used when calling a object's knowledge. @Do my_attribute, 1 will prevent any attributes used in the knowledge being prompted for, should there be any missing values. That is, the attribute is not evaluated. The IsEmpty status can be used to test if an outcome has successfully been derived for the knowledge.

Example

@Do my_proc

execute the procedure called my_proc.

Calling a procedure in JavaScript

In JavaScript procedures you can also call another JavaScript procedure just by including the procedure name - there is no requirement for an equivalent DO statement. This also enables XpertRule @command syntax procedures to be invoked (i.e. called from the JavaScript syntax procedure). This is a useful way to utilise the more specialist XpertRule @commands that are not supported by the JavaScript syntax.